{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b9474ba2",
   "metadata": {},
   "source": [
    "# 元组（tuple）\n",
    "1. 和list几乎完全一样的序列数据\n",
    "2. 和list不同的是**不可变**（因为不可变，所有几乎没有方法）\n",
    "3. 元组形式：（1，2，34，5）对比 元组（） 列表『』"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "d4ed5b6c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('10001', '10002') <class 'tuple'>\n"
     ]
    }
   ],
   "source": [
    "stu_id=\"10001\",\"10002\"\n",
    "print(stu_id,type(stu_id))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4eaabb64",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_id.count(\"10001\")#次数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "5aea260b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_id.index(\"10002\")#位置"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ebf67760",
   "metadata": {},
   "source": [
    "# 字典\n",
    "1. 创建字典三种常用方法\n",
    "直接按照字典格式：{key1:valuel,}\n",
    "dict()函数来创建字典： dict（key1=valuel）\n",
    "字典数据增加方式：新建空字典 dict_name={},dict_name[key1]=valuel"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "76c6f510",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4ed10479",
   "metadata": {},
   "outputs": [],
   "source": [
    "#直接按照字典格式：{key1:valuel,}\n",
    "stud_info={\n",
    "    \"stud_1001\":\"name1\",\n",
    "    \"stud_1002\":\"name2\",\n",
    "}\n",
    "stud_info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a3f55b5d",
   "metadata": {},
   "outputs": [],
   "source": [
    "#dict()函数来创建字典： dict（key1=valuel）\n",
    "stud_info_02=dict(\n",
    "    stud_1001=\"name1\",\n",
    ")\n",
    "stud_info_02"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8bac23ef",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
